home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2510.ZIP
/
TRSOURCE.EXE
/
PEEKBYTE.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-10-22
|
2KB
|
59 lines
; PEEKBYTE.ASM
;
; by Ralph Davis
; modified by Leonard Zerman
;
; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
;
PUBLIC PEEKBYTE
EXTRN _TR_PEEK_PARMS:FAR
INCLUDE EXTENDA.MAC
;*****************************************************
PEEKBYTE_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:PEEKBYTE_TEXT
;-----------------------------------------------------
; PEEKBYTE(segment, offset)
;
; segment = SPACE(4) && hexadecimal string
; offset = number < 65536 or hexadecimal string
;
; Returns: byte at segment:offset as an integer
; -1 if less than two parameters passed
;--------------
PEEKBYTE PROC FAR
PUSH BP
MOV BP,SP
PUSH DS
PUSH ES
PUSH BX
PUSH SI
CALL _TR_PEEK_PARMS
JL PEEKBYTE_ERR ; Sign flag set means less than 2 parms
MOV DS,SI ; Segment address returned in SI--
; move it to DS
MOV SI,AX ; Offset address returned in AX--
; move it to SI
; DS:SI now points to desired byte
MOV AL,[SI] ; pick it up
CBW ; extend the sign
JMP SHORT PEEKBYTE_EXIT ; and we're done
PEEKBYTE_ERR:
MOV AX,-1 ; return -1 for error condition
PEEKBYTE_EXIT:
POP SI
POP BX
POP ES
POP DS
POP BP
RET_INT AX ; return an integer to caller
RET
PEEKBYTE ENDP
;------------------------------------------------
PEEKBYTE_TEXT ENDS
;************************************************
END